Skip to content

fix: add background job lock TTL configuration#204

Merged
Chucks1093 merged 3 commits into
accesslayerorg:mainfrom
wheval:fix/issues-187
Apr 27, 2026
Merged

fix: add background job lock TTL configuration#204
Chucks1093 merged 3 commits into
accesslayerorg:mainfrom
wheval:fix/issues-187

Conversation

@wheval
Copy link
Copy Markdown
Contributor

@wheval wheval commented Apr 26, 2026

Summary

  • add configurable background job lock TTL via BACKGROUND_JOB_LOCK_TTL_MS with a safe default
  • add in-process lock utility with per-call TTL override support and expiration reclaim logging
  • guard POST /api/v1/admin/indexer/replay with the lock and return 409 when a lock is active
  • add focused tests for lock acquisition, TTL override, contention, expiration, and owner-aware release

Test plan

  • pnpm exec jest src/utils/test/background-job-lock.utils.test.ts --runInBand
  • pnpm exec eslint src/modules/admin/admin.controllers.ts src/utils/background-job-lock.utils.ts src/utils/test/background-job-lock.utils.test.ts src/config.ts
  • run a manual API check: trigger /api/v1/admin/indexer/replay twice quickly and verify second call returns 409

Closes #187

Add a background job lock with configurable TTL and conflict handling for indexer replay requests. Log lock acquisition and lock-expiration reclaim events to improve debugging of stuck jobs.

Closes accesslayerorg#187

Made-with: Cursor
@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented Apr 26, 2026

@wheval Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Chucks1093 Chucks1093 merged commit b5f3ffa into accesslayerorg:main Apr 27, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add background job lock TTL configuration

2 participants